 <template>
    <div id="success">
        <div class="apply">
            <ul class="line">
                <li><img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/check_pay.png"></li>
                <li class="text">订单支付成功</li>
            </ul>
            <router-link to ="/home/index/00"><button class="addBtn">逛逛首页</button></router-link>
        </div>
         <div class="yes">
		    <span class="name">商品名称</span>
		    <span class="hidden">{{orderInfo.pro_name}}</span>
	    </div>
        <div class="yes">
		    <span class="name">支付金额</span>
		    <span class="add">¥{{orderInfo.pay_money}}</span>
	    </div>
        <div class="yes">
		    <span class="name">付款时间</span>
            <span class="add">{{pay_time}}</span>
	    </div>
        
            <div class="opactive" @click="handleClick" v-if="show"></div>
            <div class="contexts"  v-if="witch">
                <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/imgChange/WechatIMG113.png" class="icon">
                <h1 class="item">砍好货</h1>
                <p>送您一个拼手气红包</P>
                <p>快发给您的小伙伴吧～</p>
                <button class="btn" @click="goBase">发红包</button>
            </div>
            <div class="num" @click="goNum" v-if="none">
                <div style="margin-top:.6rem;margin-left:.3rem;">
                    <p>第<span>{{maxNum}}</span>人领到的红包最大,</p>
                    <p>点击<span>右上角</span>继续分享,</p>
                    <p>喊好友拆手气红包吧～</p>
                </div>
            </div>
        <!--引导分享箭头-->
        <div class="arrow" v-if="arrow">
            <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/change/arrow.png">
        </div>
        <!--关闭X号-->
        <div class="styleX" v-if="showTems" @click="handleClick">
            <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/change/close_b.png">
        </div>
    </div>
</template>

<script>
    import config from "../config/config.js";
    import share from "../share/share.js";
    import store from "../store/newStore.js";
    import MtaH5 from 'mta-h5-analysis';
    export default {
        data(){
            return{
               show:true,
               witch:true,
               none:false,
               test:[],
               orderInfo:[],
               pay_time:'',
               maxNum:'',
               showTems:true,
               arrow:false
            }
        },
        computed:{
            ticket(){
                return this.$store.state.getTicket;
            }
        },
        methods:{
            handleClick(){
                this.show=false,
                this.witch = false,
                this.none = false,
                this.showTems = false,
                this.arrow = false

            },
            goBase(){
                this.show = true,
                this.witch = false,
                this.none = true,
                this.arrow = true,
                this.showTems = false
            },
            goNum(){
                this.show = false,
                this.witch = false,
                this.none = false
            },
        },
        created(){
            var _self=this;
            var value=JSON.stringify({"orderid":this.$route.params.orderId,"token":localStorage.getItem('token')}),
                key=demo(value);
            axios.post('/Home/pay/PayResult',{
                    value:value,
                    key:key,
                    ticket:this.ticket
            },config)
                .then(function(response) {
                    var that=this;
                    this.$store.commit('increment',response.data.ticket);
                    this.orderInfo=response.data.data.orderInfo;
                    this.pay_time=response.data.data.orderInfo.pay_time;
                    this.maxNum=response.data.data.couponInfo.maxNum;
                    if(response.data.data.shareid!==''){
                      this.$router.push('/freeKan/'+response.data.data.shareid)
                    }else{
                      if(response.data.data.couponInfo.type==1){
                        this.show=true,
                          this.witch = true,
                          this.none = false;
                        var link='/redbag/'+response.data.data.couponInfo.couponShareid;
                        var newLink=link.replace(/\//g,'*');
                        var obj={
                          title:'【砍好货】第'+_self.maxNum+'个人领到的最大!',
                          desc:'百元惊喜等你来撩，手快有，手慢无',
                          link:newLink,
                          imgUrl:'https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/redbag.png',
                          callback:function(){
                            that.$nextTick(function(){
                              this.show=false,
                                this.witch = false,
                                this.none = false;
                            })
                          }
                        }
                        share(obj)
                      }else{
                        this.show=false,
                          this.witch = false,
                          this.none = false;
                        share({})
                      }
                    }

                }.bind(this))
                .catch(function (error) {
                    console.log(error);
                });
            MtaH5.init({
                "sid":'500594815',
                "cid":'500595819',
                "autoReport":0,
                "senseHash":0,
                "senseQuery":0,
                "performanceMonitor":0,
                "ignoreParams":[]
            });
            MtaH5.pgv();
        },
        deactivated(){
            this.$destroy(true)
        }
    }
    
</script>

<style>
    
</style>